Skip to main content

All Questions

2votes
1answer
146views

Refactoring Processor classes

I am writing some python 3 bioinformatics software and was wondering about the best way to write it in an OOP format. I am pretty sure a lot of my classes are violating the SRP principle, but I'm not ...
Tim Kirkwood's user avatar
0votes
1answer
127views

Correct way to deduplicate conditional statements [closed]

I'm facing with problem that in every function (with serves as service for endpoint) I need to check what is value of query parameter (mode). I need to check it on many callables, E.g. def create(self,...
rozumir's user avatar
1vote
2answers
196views

Should I add functionality by adding a new method to a class - or should I "register" the new functionality into a data structure?

I have one large class that computes ~50 different metrics (each metric has no side effects). My code is similar to this: class ReportingMetrics: def __init__(self, data:pd.DataFrame, config:dict)...
MYK's user avatar
  • 343
-1votes
1answer
210views

Refactoring: Pythonic way of reducing the subclasses?

background: so, I am working on an NLP problem. where I need to extract different types of features based on different types of context from text documents. and I currently have a setup where there is ...
ultron's user avatar
2votes
0answers
69views

How to interface with very badly written code in Python? [duplicate]

I have to extend some very badly written Python code (no documentation, very interdependent, barely any encapsulation, very static, everything hard-coded, etc..) and therefore do I obviously have to ...
PPP's user avatar
  • 29
8votes
3answers
2kviews

Refactoring of a client API for avoid duplicated code and unclear passage of parameters

I need to develop an API, the functions of the API are requests that call the service exposed by a server. Initially the API worked like this: class Server: def firstRequest(self, arg1, arg2): ...
k4ppa's user avatar
3votes
0answers
119views

How to restructure Python frameworks [duplicate]

I just joined a group of five developers (non-professionals) working on a medium sized Python framework (> 50 modules, > 10.000 lines of code). The project has no documentation whatsoever and there ...
sfat's user avatar
  • 334

close